﻿@model vnMcdonald.Models.Product

@{
    ViewBag.Title = "Xem sản phẩm";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}

<h2>CHI TIẾT SẢN PHẨM</h2>
<section id="inner-box">
    <ul class="button">
        <li><a id="add" href="@Url.Action("ProductCreate", "Admin")" title="Thêm mới"><img src="~/Content/admin/images/add-icon.png" alt="Thêm" />Thêm mới</a></li>
        <li><a id="edit" href="@Url.Action("ProductEdit", "Admin", new { id = Model.ProductId })" title="Sửa"><img src="~/Content/admin/images/edit-icon.png" alt="Sửa" />Sửa</a></li>
        <li><a id="back" href="@Url.Action("Products", "Admin")" title="Trở về"><img src="~/Content/admin/images/go_back.png" alt="Trở về" />Trờ về</a></li>
        <li><a id="refresh" href="" title="Tải lại"><img src="~/Content/admin/images/refresh-icon.png" alt="Tải lại" />Tải lại</a></li>
    </ul>
    <div id="inner">
        <div class="display-field noborder">
            <label for="Name">Tên sản phẩm:</label>
            <div class="vdetail">@Html.DisplayFor(model => model.Name)</div>
        </div>
        <div class="clear"></div>
        <div class="display-field">
            <label for="Categories">Danh mục:</label>
            <div class="vdetail">@Model.Category.Name</div>
        </div>
        <div class="clear"></div>
        <div class="display-field">
            <label for="Price">Giá:</label>
            <div class="vdetail">@Html.DisplayFor(model => model.Price) VNĐ</div> 
        </div>
        <div class="clear"></div>
        <div class="display-field">
            <label for="CreateDate">Ngày tạo:</label>
            <div class="vdetail">@Html.DisplayFor(model => model.CreateDate).ToString().Substring(0, 10)</div>
        </div>
        <div class="clear"></div>
        <div class="display-field">
            <label for="Description">Chi tiết:</label>
            <div class="vdetail">@MvcHtmlString.Create(Model.Description)</div>
        </div>
        <div class="clear"></div>
        <div class="display-field">
            <label for="Image">DS Hình ảnh:</label>
            <ul id="sortable">
                 @{
                     var image = Model.Images.Where(i => i.ProductId == Model.ProductId);
                     foreach (var item in image)
                     {
                        <li>
                            <div rel="@Model.ProductId" id="@item.ImageId" class="imgproduct">
                                <img src="@item.Src" alt="" height=120 />
                                <span class="delimg"></span>
                                <div id="image-@item.ImageId">
                                    @{
            if (item.IsActive == 1)
            {
                                            @Ajax.ActionLink("Mở", "Update_status_image", new { id = item.ImageId }, new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "image-" + string.Format("{0}", item.ImageId) }, new { @class = "enable" })
                //<span class="sttimg sttimg_enable"></span>
            }
            else
            {
                                            @Ajax.ActionLink("Đóng", "Update_status_image", new { id = item.ImageId }, new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "image-" + string.Format("{0}", item.ImageId) }, new { @class = "disable" })
                //<span class="sttimg sttimg_disable"></span>
            } 
                                    }
                                </div>
                            </div>
                        </li>
                     }
                }
            </ul>
        </div>
        <div class="clear"></div>
    </div>
</section>
<script src="~/Content/admin/js/script.js"></script>
<script>
        $(document).ready(function () {
            $('#sortable').sortable({
                //axis: 'y',
                revert: true,
                stop: function (event, ui) {
                    var data = $(this).sortable('serialize');
                    //$('span').text(data);
                    //$.ajax({
                    //        data: oData,
                    //    type: 'POST',
                    //    url: '/your/url/here'
                    //});
                }
            });
        });
        //$(function () {
        //    $("#sortable").sortable({
        //        revert: true
        //    });
        //    $("tr").disableSelection();
        //});
	</script>
